package org.learn.java.mq.acs;

import org.learn.java.mq.MqContent;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;

public class MyIAcsClient {
	private static String regionId = "cn-beijing";
	private static String accessKey = MqContent.MQ_AccessKey ;
	private static String secretKey = "7JbgLiklyNxmkXQkM0iBKWuyqNvnjU";
	private static String endPointName = "cn-beijing";
	private static String productName = "Ons";
	private static String domain = "ons.cn-beijing.aliyuncs.com";

	private static IAcsClient iAcsClient;

	static {
		/**
		 * 根据自己所在的区域选择Region后,设置对应的接入点
		 */
		try {
			DefaultProfile.addEndpoint(endPointName, regionId, productName,
					domain);
		} catch (ClientException e) {
			e.printStackTrace();
		}
		IClientProfile profile = DefaultProfile.getProfile(regionId, accessKey,
				secretKey);
		iAcsClient = new DefaultAcsClient(profile);

	}

	private MyIAcsClient() {
	}

	public static IAcsClient getInstance() {
		return iAcsClient;
	}

}
